<template>
	<view>
		<!--  -->
		<view class="">
			<view class="flex bg_f7 ">
				<view class="mr30"></view>
				<u--image :showLoading="true" :src="applyUser.uavatar" width="80px" height="80px" @click="click"></u--image>
				<view class="flex-column  ml30">
					<view class="">{{ applyUser.unickName }}</view>
					<view class="flex">
						<view class="">地区 :</view>
						<view class="">湖北 武汉</view>
					</view>
				</view>
			</view>
			<u-gap height="10" bgColor="#bbb"></u-gap>
			<view class="flex flex-align bg_f7 h80">
				<view class="mr30"></view>
				<view class="mr124" style="color: black;">来源:</view>
				<view class="color_98">手机号搜索</view>
			</view>
			<u-gap height="10" bgColor="#bbb"></u-gap>
			<view class="flex-cen bg_f7 h80"><view class="color_22" @click="applyFriend">添加好友</view></view>
		</view>
		<!--  -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			src: 'https://cdn.uviewui.com/uview/album/1.jpg',
			search: '',
			applyUser: {}
		};
	},
	methods: {
		click() {},
		async applyFriend() {
			let re = null;
			let data = {
				ucomeFrom: 1,
				udescription: '添加好友',
				ufriendId: this.applyUser?.userId || 123,
				uremark: this.applyUser.unickName || '默认用户',
				uavatar: this.applyUser.uavatar || 'https://cdn.uviewui.com/uview/album/1.jpg'
			};
			try {
				re = await this.$API.friendApi.applyAddFriend(data);
				console.log(re, 're');
				uni.showToast({
					title: '添加成功'
				});
			} catch (e) {
				console.log(e);
			}
		}
	},
	onLoad(options) {
		// console.log(options, 'options');
		let data = JSON.parse(decodeURIComponent(options.data));
		// console.log(data, 'data');
		this.applyUser = data;
		// console.log(this.applyUser, 'this.applyUser');
		/* 填写用户消息 */
	},
	onShow(options) {
		// let data = JSON.parse(decodeURIComponent(options.data));
		// this.applyUser = data.data;
		// console.log(this.applyUser, 'this.applyUser');
		/* 填写用户消息 */
	}
};
</script>

<style lang="scss"></style>
